import iconCompon from './index'
import { defineComponent, h, type Component } from 'vue'

type AttrsInter = {
  // iconify (https://docs.iconify.design/icon-components/vue/#properties)
  inline?: boolean
  width?: string | number
  height?: string | number
  flip?: string
  rotate?: number | string
  color?: string
  verticalAlign?: boolean
  align?: string
  style?: object
}

export default function XyIconRender(icon: string, attrs?: AttrsInter): Component {
  return defineComponent({
    name: 'XyIconRender',
    render() {
      return h(iconCompon, {
        icon,
        ...attrs
      })
    }
  })
}
